package com.ruoyi.jproom.service.impl;

import com.ruoyi.jproom.entity.Housing;
import com.ruoyi.jproom.mapper.HousingManageMapper;
import com.ruoyi.jproom.mapper.ImageInfoMapper;
import com.ruoyi.jproom.service.HousingEntrustService;
import com.ruoyi.jproom.service.HousingManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author zeo
 * @explain 房源服务实现类
 * @date 2020/7/27 11:08
 */
@Service
public class HousingManageServiceImpl implements HousingManageService {

    @Autowired
    HousingManageMapper housingManageMapper;

    @Autowired
    ImageInfoMapper imageInfoMapper;

    @Override
    public List<Housing> findRentHousingList(Housing housing) {
        return housingManageMapper.findRentHousingList(housing);
    }

    @Override
    public Housing findHousingByHousingId(String housingId) {
        Housing housing = housingManageMapper.findHousingByHousingId(housingId);
        housing.setImageInfoList(imageInfoMapper.findImageInfoListBySellId(housing.getHousingId()));
        return housing;
    }

    @Override
    public int rentHousingEdit(Housing housing) {
        return housingManageMapper.rentHousingEdit(housing);
    }

    @Override
    public List<Housing> findSellHousingList(Housing housing) {
        return housingManageMapper.findSellHousingList(housing);
    }

    @Override
    public int toVoidHousing(String housingId) {
        return housingManageMapper.toVoidHousing(housingId);
    }
}
